package phone.qyg.com.qyg.fragment;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.ToxicBakery.viewpager.transforms.ABaseTransformer;
import com.ToxicBakery.viewpager.transforms.AccordionTransformer;
import com.app.adapter.recycler.MultiItemTypeAdapter;
import com.app.adapter.recycler.RecyclerSpace;
import com.app.application.QXApplication;
import com.app.base.tool.BaseFragment;
import com.app.config.AppHttpKey;
import com.app.config.ApplicationConfig;
import com.app.utils.CommonUtil;
import com.app.utils.JSONTool;
import com.app.utils.NotificationUtil;
import com.app.utils.OptionImageUtils;
import com.app.utils.SharePrefUtil;
import com.app.utils.SystemPrintl;
import com.app.utils.TransformController;
import com.app.view.CustomScrollView;
import com.app.view.RatioFrameLayout;
import com.app.xutils.MyCallBack;
import com.app.xutils.Xutils;
import com.bigkoo.convenientbanner.holder.CBViewHolderCreator;
import com.bigkoo.convenientbanner.listener.OnItemClickListener;
import com.liaoinstan.springview.container.AliHeader;
import com.liaoinstan.springview.widget.SpringView;

import org.xutils.view.annotation.Event;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import phone.qyg.com.qyg.R;
import phone.qyg.com.qyg.activity.ActivityDetailActivity;
import phone.qyg.com.qyg.activity.ActivityListActivity;
import phone.qyg.com.qyg.activity.ActivityRegisActivity;
import phone.qyg.com.qyg.activity.AppFindActivity;
import phone.qyg.com.qyg.activity.ContentListActivity;
import phone.qyg.com.qyg.activity.CourseDetailActivity;
import phone.qyg.com.qyg.activity.CourseListActivity;
import phone.qyg.com.qyg.activity.CulturalListActivity;
import phone.qyg.com.qyg.activity.CulturalMarkActivity;
import phone.qyg.com.qyg.activity.CultureListActivity;
import phone.qyg.com.qyg.activity.HtmlActivity;
import phone.qyg.com.qyg.activity.LoginActivity;
import phone.qyg.com.qyg.activity.MsgActivity;
import phone.qyg.com.qyg.activity.MyActivity;
import phone.qyg.com.qyg.activity.SupermarketActivity;
import phone.qyg.com.qyg.activity.VenueListActivity;
import phone.qyg.com.qyg.activity.VenuesDetailActivity;
import phone.qyg.com.qyg.activity.VenuesListActivity;
import phone.qyg.com.qyg.activity.VideoActivity;
import phone.qyg.com.qyg.activity.VolunteerActivity;
import phone.qyg.com.qyg.adapter.AllAdapter;
import phone.qyg.com.qyg.model.Activity;
import phone.qyg.com.qyg.model.Base;
import phone.qyg.com.qyg.model.Content;
import phone.qyg.com.qyg.model.Course;
import phone.qyg.com.qyg.model.Message;
import phone.qyg.com.qyg.model.Roll;
import phone.qyg.com.qyg.model.SuperMarket;
import phone.qyg.com.qyg.model.Venues;
import phone.qyg.com.qyg.utils.AppHttpRequest;
import phone.qyg.com.qyg.utils.NetworkImageHolderView;

/**
 * 作者：lblbh on 2017/11/28 10:53
 * 邮箱：lanbuhan@163.com
 * 功能：首页
 */
public class HomeFragment extends BaseFragment {

    @ViewInject(R.id.springview)
    SpringView springview;

    @ViewInject(R.id.home_title_all_layout)
    LinearLayout home_title_all_layout;

    @ViewInject(R.id.home_title_layout)
    LinearLayout home_title_layout;

    @ViewInject(R.id.scroll_view)
    CustomScrollView scroll_view;

    @ViewInject(R.id.convenientBanner)
    com.app.view.ConvenientBanner convenientBanner;

    @ViewInject(R.id.user_login)
    TextView user_login;

    @ViewInject(R.id.find)
    TextView find;

    @ViewInject(R.id.msg)
    TextView msg;

    @ViewInject(R.id.broadcast_more)
    TextView broadcast_more;

    @ViewInject(R.id.venue_more)
    TextView venue_more;

    @ViewInject(R.id.course_more)
    TextView course_more;

    @ViewInject(R.id.act_more)
    TextView act_more;

    @ViewInject(R.id.supermarket_more)
    TextView supermarket_more;

    @ViewInject(R.id.img_supermarket_one)
    ImageView img_supermarket_one;

    @ViewInject(R.id.text_supermarket_one)
    TextView text_supermarket_one;

    @ViewInject(R.id.img_supermarket_two)
    ImageView img_supermarket_two;

    @ViewInject(R.id.text_supermarket_two)
    TextView text_supermarket_two;

    @ViewInject(R.id.img_supermarket_there)
    ImageView img_supermarket_there;

    @ViewInject(R.id.text_supermarket_there)
    TextView text_supermarket_there;

    @ViewInject(R.id.home_new_recycler)
    RecyclerView home_new_recycler;

    @ViewInject(R.id.home_venue_recycler)
    RecyclerView home_venue_recycler;

    @ViewInject(R.id.home_course_recycler)
    RecyclerView home_course_recycler;

    @ViewInject(R.id.home_act_recycler)
    RecyclerView home_act_recycler;

    @ViewInject(R.id.super_linear)
    LinearLayout super_linear;

    @ViewInject(R.id.super_two_linear)
    LinearLayout super_two_linear;

    @ViewInject(R.id.super_there_linear)
    RatioFrameLayout super_there_linear;

    @ViewInject(R.id.home_title_view)
    View home_title_view;

    @ViewInject(R.id.venue_rela)
    LinearLayout venue_rela;

    @ViewInject(R.id.video_rel)
    LinearLayout video_rel;

    @ViewInject(R.id.ll_course_more)
    LinearLayout ll_course_more;

    @ViewInject(R.id.act_rela2)
    LinearLayout act_rela2;

    @ViewInject(R.id.ll_cultural)
    LinearLayout ll_cultural;

    @ViewInject(R.id.ll_cultural_mark)
    LinearLayout ll_cultural_mark;

    @ViewInject(R.id.ll_volunteer)
    LinearLayout ll_volunteer;

    @ViewInject(R.id.ll_qw)
    LinearLayout ll_qw;

    ScheduledFuture scheduledFuture;

    List<SuperMarket> supermarkets;

    @Override
    public View initView(LayoutInflater inflater) {
        View view = View.inflate(QXApplication.getContext(), R.layout.home,null);
        x.view().inject(this,view);
        return view;
    }

    @Override
    public void initData(Bundle savedInstanceState) {

        setCourseRecycleLayoutManager();

        initHomeRoll();

        initHomeData();

        initAppInfo();

        isAppLogin();

        scroll_view.setOnScollChangedListener(new CustomScrollView.OnScollChangedListener() {
            @Override
            public void onScrollChanged(CustomScrollView scrollView, int x, int y, int oldx, int oldy) {
                if(y>ApplicationConfig.HOMR_TITLE_HEIGHT){
                    home_title_view.setBackgroundResource(R.color.login_fill_btn);
                    home_title_layout.setBackgroundResource(R.color.login_fill_btn);
                }else{
                    home_title_view.setBackgroundResource(R.color.no_color);
                    home_title_layout.setBackgroundResource(R.color.no_color);
                }
            }
        });

        springview.setListener(new SpringView.OnFreshListener() {
            @Override
            public void onRefresh() {
                initHomeData();
                initHomeRoll();
            }

            @Override
            public void onLoadmore() {
            }
        });

        springview.setHeader(new AliHeader(ct,false));
    }


    private void initHomeData() {
        if(CommonUtil.isNetWork()){
            Xutils.Get(ApplicationConfig.NET_DSN_PATH + ApplicationConfig.HOME_LIST,
                    null,
                    new MyCallBack<String>(){
                        @Override
                        public void onSuccess(String result) {
                            super.onSuccess(result);
                            setHomeData(result);
                            SharePrefUtil.saveString(SharePrefUtil.KEY.HOME_DATA,result);
                        }

                        @Override
                        public void onFinished() {
                            super.onFinished();
                            springview.onFinishFreshAndLoad();
                        }
                    });
        }else{
            String saveData = SharePrefUtil.getString(SharePrefUtil.KEY.HOME_DATA,null);
            if(isRequestStr(saveData)){
                setHomeData(saveData);
            }
        }
    }


    /**
     * 设置数据
     * @param result
     */
    private void setHomeData(String result){
        List<Content> contents = JSONTool.jsonDefaluTranClazzs(result,JSONTool.Enum.CONTENT_LIST, Content.class);
        List<Venues> venues = JSONTool.jsonDefaluTranClazzs(result,JSONTool.Enum.VENUE_LIST, Venues.class);
        List<Course> courses = JSONTool.jsonDefaluTranClazzs(result,JSONTool.Enum.COURSE_LIST, Course.class);
        List<Activity> acts = JSONTool.jsonDefaluTranClazzs(result,JSONTool.Enum.ACT_LIST, Activity.class);
        supermarkets = JSONTool.jsonDefaluTranClazzs(result,JSONTool.Enum.RES_LIST, SuperMarket.class);

        setContentData(contents);
        setVenuesData(venues);
        setCourseData(courses);
        setActData(acts);
        setSuperMarket(supermarkets);
    }

    private void setSuperMarket(List models){

        if(!isRequestList(models)){
            super_linear.setVisibility(View.GONE);
            return;
        }

        final SuperMarket oneMarket = (SuperMarket) models.get(0);
        OptionImageUtils.setImage43(img_supermarket_one,oneMarket.fixImgUrl);
        text_supermarket_one.setText(CommonUtil.setAttributeText(oneMarket.title));

        img_supermarket_one.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                superMarketItemOnClick(oneMarket);
            }
        });

        int size = models.size();
        if(size == 1){
            super_two_linear.setVisibility(View.GONE);
            return;
        }

        final SuperMarket twoMarket = (SuperMarket) models.get(1);
        OptionImageUtils.setImage43(img_supermarket_two,twoMarket.fixImgUrl);
        text_supermarket_two.setText(CommonUtil.setAttributeText(twoMarket.title));

        img_supermarket_two.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                superMarketItemOnClick(twoMarket);
            }
        });

        if(size == 2){
            super_there_linear.setVisibility(View.GONE);
            return;
        }

        final SuperMarket thereMarket = (SuperMarket) models.get(2);
        OptionImageUtils.setImage43(img_supermarket_there,thereMarket.fixImgUrl);
        text_supermarket_there.setText(CommonUtil.setAttributeText(thereMarket.title));

        img_supermarket_there.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                superMarketItemOnClick(thereMarket);
            }
        });
    }



    /**
     * 设置活动
     * @param models
     */
    private void setActData(List models){
        if(!isRequestList(models))return;
        LinearLayoutManager layoutVerManager = new LinearLayoutManager(QXApplication.getContext());
        layoutVerManager.setOrientation(LinearLayoutManager.VERTICAL);
        home_act_recycler.setLayoutManager(layoutVerManager);
        final AllAdapter adapter = new AllAdapter(QXApplication.getContext(),models);
        adapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
                Object obj = adapter.getDatas().get(position);
                TransformController.transformControllerModel(QXApplication.getContext(), ActivityDetailActivity.class,obj);
            }

            @Override
            public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
                return false;
            }
        });
        home_act_recycler.setAdapter(adapter);
    }

    /**
     * 设置课程
     * @param models
     */
    private void setCourseData(List models){
        if(!isRequestList(models))return;
        final AllAdapter adapter = new AllAdapter(QXApplication.getContext(),models);
        adapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
                Object obj = adapter.getDatas().get(position);
                TransformController.transformControllerModel(QXApplication.getContext(), CourseDetailActivity.class,obj);
            }

            @Override
            public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
                return false;
            }
        });
        home_course_recycler.setAdapter(adapter);
    }

    /**
     * 设置场馆
     * @param models
     */
    private void setVenuesData(List models){
        if(!isRequestList(models))return;
        LinearLayoutManager layoutVerManager = new LinearLayoutManager(QXApplication.getContext());
        layoutVerManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        home_venue_recycler.setLayoutManager(layoutVerManager);
        final AllAdapter adapter = new AllAdapter(QXApplication.getContext(),models);
        adapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
                Object obj = adapter.getDatas().get(position);
                TransformController.transformControllerModel(QXApplication.getContext(), VenuesDetailActivity.class,obj);
            }

            @Override
            public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
                return false;
            }
        });
        home_venue_recycler.setAdapter(adapter);
    }

    /**
     * 设置新闻
     * @param models
     */
    private void setContentData(List models){
        if(!isRequestList(models))return;
        LinearLayoutManager layoutVerManager = new LinearLayoutManager(QXApplication.getContext());
        layoutVerManager.setOrientation(LinearLayoutManager.VERTICAL);
        home_new_recycler.setLayoutManager(layoutVerManager);
        final AllAdapter adapter = new AllAdapter(QXApplication.getContext(),models);
        adapter.setOnItemClickListener(new MultiItemTypeAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) {
                Object obj = adapter.getDatas().get(position);
                TransformController.transformControllerModel(QXApplication.getContext(), HtmlActivity.class,obj);
            }

            @Override
            public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) {
                return false;
            }
        });
        home_new_recycler.setAdapter(adapter);
    }

    private void initHomeRoll(){

        if(CommonUtil.isNetWork()){
            fMapKeys.put(AppHttpKey.ROLL_TYPE,"0");
            Xutils.Get(ApplicationConfig.NET_DSN_PATH + ApplicationConfig.ROLL_PIC,
                    fMapKeys,
                    new MyCallBack<String>(){
                        @Override
                        public void onSuccess(String result) {
                            super.onSuccess(result);
                            setHomeRoll(result);
                            SharePrefUtil.saveString(SharePrefUtil.KEY.HOME_ROLL,result);
                        }
                    });
        }else{
            String saveData = SharePrefUtil.getString(SharePrefUtil.KEY.HOME_ROLL,null);
            if(isRequestStr(saveData)){
                setHomeRoll(saveData);
            }
        }
    }

    private void setHomeRoll(String result){
        List<Roll> rolls = JSONTool.jsonDefaluTranClazzs(result,JSONTool.Enum.CONTENT_LIST, Roll.class);
        setRoolDate(rolls);
    }

    private void setRoolDate(final List<Roll> models){
        if(!isRequestList(models)) return;

        List<String> urls = new ArrayList<String>();

        for (int i=0,j=models.size();i<j;i++){
            Roll roll = models.get(i);
            urls.add(roll.fixImgUrl);
        }
        convenientBanner.setPages(
                new CBViewHolderCreator<NetworkImageHolderView>() {
                    @Override
                    public NetworkImageHolderView createHolder() {
                        return new NetworkImageHolderView();
                    }
                }, urls)
                //设置两个点图片作为翻页指示器，不设置则没有指示器，可以根据自己需求自行配合自己的指示器,不需要圆点指示器可用不设
                .setPageIndicator(new int[]{R.drawable.roll_normal, R.drawable.roll_focus})
                //设置指示器的方向
//                .setPageIndicatorAlign(ConvenientBanner.PageIndicatorAlign.ALIGN_PARENT_RIGHT)
//                .setOnPageChangeListener(this)//监听翻页事件
                .setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(int position) {
                        Roll roll = models.get(position);

                        if(roll == null)
                            return;

                        int type = roll.type;

                        if(type == 0)
                            return;

                        /**
                         “type”: 1     //轮播图类型：0-普通（无链接）1-网页链接，2-活动，3-场馆，4-专题，5-课程
                         “objectId”: 21   //对象ID（活动，场馆，专题，课程）

                         */
                        Class clazz = null;
                        if(type == 1){
                            //网页
                            clazz = HtmlActivity.class;
                        }else if(type == 2){
                            //活动
                            clazz = ActivityDetailActivity.class;
                        }else if(type == 3){
                            //场馆
                            clazz = VenuesDetailActivity.class;
                        }else if(type == 4){
                            //专题
                            clazz = CultureListActivity.class;
                        }else if(type ==5) {
                            //课程
                            clazz = CourseDetailActivity.class;
                        }

                        if(clazz != null)
                            TransformController.transformControllerModel(QXApplication.getContext(),clazz,roll);
                    }
                });
        convenientBanner.notifyDataSetChanged();

        try {
            Class cls = Class.forName("com.ToxicBakery.viewpager.transforms."+AccordionTransformer.class.getSimpleName());
            ABaseTransformer transforemer= (ABaseTransformer)cls.newInstance();
            convenientBanner.getViewPager().setPageTransformer(true,transforemer);

            //部分3D特效需要调整滑动速度
//            if(transforemerName.equals("StackTransformer")){
//                convenientBanner.setScrollDuration(1200);
//            }

        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (java.lang.InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }

    private void setCourseRecycleLayoutManager(){
        GridLayoutManager girdLayoutManager = new GridLayoutManager(QXApplication.getContext(),2,GridLayoutManager.VERTICAL,false);
//        home_course_recycler.addItemDecoration( new RecyclerViewItemDecoration(
//                RecyclerViewItemDecoration.MODE_GRID,
//                getResources().getColor(R.color.white),
//                10,0,0));
        RecyclerSpace space = new RecyclerSpace(10, Color.WHITE,1);
        home_course_recycler.addItemDecoration(space);
        home_course_recycler.setLayoutManager(girdLayoutManager);
    }


    @Event(value = {R.id.user_login,R.id.find,R.id.msg,R.id.broadcast_more,R.id.venue_more,
                    R.id.course_more,R.id.act_more,R.id.supermarket_more,R.id.venue_rela,R.id.video_rel,
                    R.id.ll_course_more,R.id.act_rela2,R.id.ll_cultural,R.id.ll_cultural_mark,R.id.ll_volunteer,
                    R.id.ll_qw
                    })
    private void viewOnClick(View v){

        Class clazz = null;
        switch (v.getId()){
            case R.id.user_login:
                Intent cast = new Intent();
                cast.setAction("selectMy");
                getActivity().sendBroadcast(cast);
//                clazz = MyActivity.class;
                break;
            case R.id.find:
                TransformController.transformControllerModel(QXApplication.getContext(),
                        AppFindActivity.class,
                        new Base(QXApplication.getContext().getString(R.string.all)));
                break;
            case R.id.msg:
                String appInfo = SharePrefUtil.getString(SharePrefUtil.KEY.APP_USER,"");
                if(isRequestStr(appInfo)){
                    clazz = MsgActivity.class;
                }else{
                    clazz = LoginActivity.class;
                }
                break;
            case R.id.broadcast_more:
                clazz = ContentListActivity.class;
                break;
            case R.id.venue_more:
                clazz = VenuesListActivity.class;
                break;
            case R.id.course_more:
                clazz = CourseListActivity.class;
                break;
            case R.id.act_more:
                clazz = ActivityListActivity.class;
                break;
            case R.id.supermarket_more:
//                SystemPrintl.show();
                clazz = SupermarketActivity.class;
                break;
            case R.id.venue_rela:
                //场馆
                clazz = VenueListActivity.class;
                break;
            case R.id.video_rel:
                clazz = VideoActivity.class;
                break;
            case R.id.ll_course_more:
                clazz = CourseListActivity.class;
                break;
            case R.id.act_rela2:
                clazz = ActivityRegisActivity.class;
                break;
            case R.id.ll_cultural:
                clazz = CulturalListActivity.class;
                break;
            case R.id.ll_cultural_mark:
                clazz = CulturalMarkActivity.class;
                break;
            case R.id.ll_volunteer:
//                clazz = VolunteerActivity.class;
                Intent intent = new Intent(QXApplication.getContext(),VolunteerActivity.class);
                intent.putExtra("type",0);
                startActivity(intent);
                break;
            case R.id.ll_qw:
                Intent intent2 = new Intent(QXApplication.getContext(),VolunteerActivity.class);
                intent2.putExtra("type",1);
                startActivity(intent2);
                break;
        }

        if(clazz != null)
            TransformController.transformController(QXApplication.getContext(), clazz);
    }


    private void isAppLogin(){
        LocalBroadcastManager broadcastManager = LocalBroadcastManager.getInstance(ct);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(ApplicationConfig.APP_QX_LOGIN);
        BroadcastReceiver mItemViewListClickReceiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
//                intent.putExtra(TransformController.ChangeKEY.INTENT_KEY,result);
                String result = intent.getStringExtra(TransformController.ChangeKEY.INTENT_KEY);
                if(CommonUtil.isRequestStr(result)){
                    initAppInfo();
                }
            }
        };
        broadcastManager.registerReceiver(mItemViewListClickReceiver, intentFilter);
    }

    private void initAppInfo(){
        if(!CommonUtil.isRequestStr(SharePrefUtil.getString(SharePrefUtil.KEY.APP_USER, ""))){
            if(scheduledFuture != null){
                scheduledFuture.cancel(true);
            }
            return;
        }
        ScheduledExecutorService service = Executors
                .newSingleThreadScheduledExecutor();
        scheduledFuture = service.scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                boolean appInfoSwitch= SharePrefUtil.getBoolean(SharePrefUtil.KEY.APP_INFO_SWITCH,false);
                if(!appInfoSwitch)return;
                AppHttpRequest.httpNoticeServiceHost(new AppHttpRequest.OnAppInfoListener() {
                    @Override
                    public void onAppInfo(final boolean isNewInfo, final String result) {
                        SystemPrintl.systemPrintl("消息请求结果是-->"+result);
                        CommonUtil.runOnUIThread(new Runnable() {
                            @Override
                            public void run() {
                                CommonUtil.setTextViewDrawableDirection(msg,6,isNewInfo?R.drawable.home_msg_select:R.drawable.home_msg_normal);

                                if(isNewInfo){
                                    List<Message> msgs = JSONTool.jsonDefaluTranClazzs(result,JSONTool.Enum.MESS_LIST,Message.class);


                                    if(isRequestList(msgs)){
                                        for (int i=0,j=msgs.size();i<j;i++){
                                            NotificationUtil.sendNotification(ct,msgs.get(i));
                                        }
                                    }
                                }

                            }
                        });
                    }
                });
            }
        }, 0, ApplicationConfig.APP_INFO_TIME, TimeUnit.SECONDS);

    }

    /**
     * 文化超市点击处理
     * @param itemMarket
     */
    private void superMarketItemOnClick(SuperMarket itemMarket){
        TransformController.transformControllerModel(QXApplication.getContext(), CultureListActivity.class,itemMarket);
    }



    // 开始自动翻页
    @Override
    public void onResume() {
        super.onResume();
        //开始自动翻页
        convenientBanner.startTurning(3000);
    }

    // 停止自动翻页
    @Override
    public void onPause() {
        super.onPause();
        //停止翻页
        convenientBanner.stopTurning();
    }


    @Override
    public void onNetChange(int netMobile) {}
}
